package universityModel.person;

/**
 *
 * @author Parkhomenko Dmytro
 */

abstract public class Person implements PersonInterface {
    private Name name;
    private BiographicalData biographicalData;
    LearningProcess  learningProcess;

    public Person(Name name, BiographicalData biographicalData) {
        this.name = name;
        this.biographicalData = biographicalData;
    }
	
    public abstract String getProffesionalDescription();
	
    public Name getName() {
	return name.clone();
    }

    public void setLearningProcess(LearningProcess learningProcess) {
        this.learningProcess = learningProcess;
    }

    public void performLearningProcess() {
        learningProcess.work();
    }

    @Override
    public boolean equals(Object obj) {
        if (this == obj) {
            return true;
	}
		
        if (obj == null) {
		return false;
	}
        
	if (getClass() != obj.getClass()) {
		return false;
	}
       
        Person person = (Person)obj;
        
        return  this.name.equals(person.getName());
    }
    
    @Override
    public String toString() {
        return name + "\n" + 
               biographicalData;
    }
}